#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int countPrefixes(vector<string>& words, string s) {
        int res = 0;
        for (const auto& str : words)
        {
            int i = 0, j = 0;
            for (; i < str.size() && j < s.size(); ++i, ++j)
            {
                if (str[i] != s[j])
                    break;
            }
            if (i == str.size())
                ++res;
        }
        return res;
    }
};